<?php require_once(getcwd()."/includes/session.php"); ?>
<?php 
	if ((!is_file(getcwd()."/includes/connection.php")) || (!is_file(getcwd()."/includes/settings.php"))) { 
		echo "Jukebox not <a href='setup.php'>setup</a>"; 
		die;
	}
?>
<?php 
	require_once(getcwd()."/includes/connection.php");
	$result = mysql_query("SELECT * FROM users") or die("Jukebox not <a href='/setup.php'>setup</a>");
	$result = mysql_query("SELECT * FROM users WHERE username = '".$_SESSION['username']."'") or die;
	$row = mysql_fetch_array($result);
	if ($row['admin'] == 1) define('ADMIN','1');
	else define('ADMIN','0');
?>
<?php require_once(getcwd()."/includes/functions.php"); ?>
<?php confirm_logged_in(); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
	<head>
		<title>Jukebox</title>
		<link rel="stylesheet" type="text/css" href="css/nopad.css" /> 
		<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
		<link type="text/css" href="css/custom-theme/jquery-ui-1.8.2.custom.css" rel="stylesheet" />	
		<script type="text/javascript" src="js/jquery-ui-1.8.2.custom.min.js"></script>
		<script type="text/javascript" src="js/jquery.scrollTo-1.4.2-min.js"></script>
		<script src="http://www.google.com/jsapi"></script>
		<script>
			google.load('swfobject', '2.2');
		</script>
		<script type="text/javascript" type="text/javascript">
			var pos = '';
			var dur = '';
			var min = '';
			var sec = '';
			function droplive(all) {	//resets all users online status
				if (all == 'all') {  
					$.ajax({
						url:"admin.php",
						type:"POST",
						global:false,
						data:({ clearcurrent:true })
					});
				}
				else {
					$.ajax({
						url:"view.php",
						type:"POST",
						global:false,
						data:({ 
							view:'current',
							user:'<?php echo $_SESSION['username']; ?>',
							currentsong:'',
							songid:'' 
						})
					}); 
				}
			}
			function trim(string) { 
				return string.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
			}
			function inArray(elem,array) {
				for ( var i = 0, length = array.length; i < length; i++ ) {
					if ( array[i].toLowerCase() == elem.toLowerCase() ) {
						return i;
					}
				}
				return -1;
			}
			function postLive(artist,track,songid,duration,cover,stream) { //posts users current song
				if (!stream) stream = '';
				if (artist == "idle") {
					$.ajax({
						url:"view.php",
						type:"POST",
						global:false,
						data:({ 
							view:'current', 
							user:'<?php echo $_SESSION['username']; ?>',
							current:'idle' 
						})
					}); 	
				}
				else if (stream != '') {
					document.title = artist+' - '+track;
					$.ajax({
						url:"view.php",
						type:"POST",
						global:false,
						data:({ 
							view:'current', 
							user:'<?php echo $_SESSION['username']; ?>', 
							current:artist , 
							currentsong:track, 
							stream:'true', 
							songid:stream, 
							duration:duration, 
							cover:cover 
						})
					});
				}
				else if (stream == '') {
					document.title = artist+' - '+track;
					$.ajax({	
						url:"view.php",
						type:"POST",
						global:false,
						data:({ 
							view:'current', 
							user:'<?php echo $_SESSION['username']; ?>', 
							current:artist , 
							currentsong:track, 
							songid:songid, 
							duration:duration, 
							cover:cover 
						})
					}); 
				}
			}
			function diInfo() { //grabs di.fm streams
				$.ajax({
					url:"view.php",
					type:"GET",
					global:false,
					data:({ view:"imported" }),
					success: function(a) { 
						$('#distreams').html(a); 
					}
				});
			}
			function streamInfo(server) { //grabs the streams metadata
				$.ajax({
					url:"shoutcast_song_title.php",
					type:"GET",
					global:false,
					data:({ server:server }),
					success: function(a) { 
						$('#bottombox').text(a); 
					}
				});
			}
			var player = null;	
			function playerReady(obj) { //jwplayer ready callback
				if ($('input:#rvideo').is(':checked')) {			
					player = document.getElementById(obj.id);
					list = new Array();
					$('#rc').css('height','555px');
					$('#nowplayingvideo').show();
					$('#nowplayingvideo').position({ 
						my:'left bottom', 
						at:'right bottom', 
						of:'#left', 
						offset:'9 0' 
					});
					$('#nowplayingvideo').position({ 
						my:'left bottom', 
						at:'right bottom', 
						of:'#left', 
						offset:'11 0' 
					}); // for some reason opera doesn't place it properly with one position() command..?
					$('#buttonbox').position({ 
						my:'left bottom', 
						at:'left top', 
						of:'#nowplayingvideo', 
						offset:'0 -1' 
					});
					$('#buttonbox').position({ 
						my:'left bottom', 
						at:'left top', 
						of:'#nowplayingvideo', 
						offset:'0 0' 
					});
				}
				else {
					player = document.getElementById(obj.id);
					list = new Array();
				}
				addListeners(player);
				vol=parseInt(player.getConfig().volume);
				$('#volume').slider({ value:vol });
				$('#amount').text(vol);
			}
			function totalTime() {  //sets total playlist time, and tracks
				var b=0;
				$('.newtrack').each(function() { 
					b = b+parseInt($(this).attr('duration')); 
				});
				var hours=Math.floor(b/3600);
				var minutes=Math.floor(b/60)-(hours*60);
				var seconds=b-(hours*3600)-(minutes*60);
				var hs=' hour';
				var ms=' minute';
				var ss=' second';
				if (hours!=1) {hs+='s'}
				if (minutes!=1) {ms+='s'}
				if (seconds!=1) {ss+='s'}
				var tracks = $('#pl .newtrack').size();
				$('#plfoot').html("<span style='float:left;'>Total playing time:"+hours+hs+", "+minutes+ms+", "+seconds+ss+"</span><span style='float:right; margin-right:10px;'>"+tracks+" tracks</span>");
			}
			function addListeners(obj) {
				if (obj) { 
					obj.addModelListener("STATE","mp3Check");
					obj.addModelListener("TIME","progUpdate");
					obj.addControllerListener("VOLUME","volumeListener");
					obj.addControllerListener("MUTE", "muteListener");
				}
				else setTimeout("addListeners("+obj+")",100);
			}
			function oneShot() {
				ajaxFunction('asdf','chat');
			}
			function doit() {
				ajaxFunction('asdf','chat');
				setTimeout("doit()",5000);
			}
			function randTrack(a) { return Math.random()*a | 0; }
			function progUpdate(obj) { //progressbar callback
				var text='';
				for (itm in obj) {
					if (itm == 'position') {
						var pos = obj[itm];
						var dur = obj.duration;
						pos = Math.floor(pos);
						$('#slider').slider({ value:pos });
						min = Math.floor(pos/60);  
						sec = pos % 60;
						sec = Math.round(sec);
						if (sec < 10) { sec = '0'+sec; }
						text = min+':'+sec+' /';
						if ($('.np_pos').text() != text) { 
							$('.np_pos').text(min+':'+sec+' /');
						}
					}
				} 
			}
			function shuffleCheck() {	
				var b = randTrack($(".newtrack").size()-1);
				if ($('#cshuffle:checkbox:checked').val() == "on") {
					$('.newtrack').eq(b).click();
				}
				else if (parseInt($('.nowplaying').next().attr('duration')) > 0) {
					$('.nowplaying').next().click();
				}
				else if ($('#crepeat:checkbox:checked').val() == "on") {
					$('.newtrack:first').click();  
				}
			}
			function mp3Check(obj) { //state listener for jwplayer
				currentState = obj.newstate;
				if (currentState == "COMPLETED") shuffleCheck();
				if (currentState == "PLAYING") playpause('ui-icon-pause');
				if (currentState == "PAUSED") playpause('ui-icon-play');
				if (currentState == "IDLE") { 
					droplive(); 
					playpause('ui-icon-play');
				}	
			}	
			function muteListener(obj) {
				currentMute = obj.state; 
				if (currentMute == true) { 
					$('#mute').button({ 
						icons: { 
							primary: 'ui-icon-volume-off' 
						}  
					}); 
				}  
				else { 
					$('#mute').button({ 
						icons: { 
							primary: 'ui-icon-volume-on' 
						} 
					}); 
				}
			}
			function streamStart(thelist) { 
				player.sendEvent('LOAD',thelist); 
			}
			function playpause(icon) { 
				$('#cplaypause').button({ 
					icons: { 
						primary: icon	
					} 
				}); 
			}
			function home() {
				$('#tracks').show();
				$('#playlist').hide();
				$('#leftinner .tracklist').hide();	
				$('#albuminfo').show()
				$('#chat').show();
				if ($('#nowplayingtext').length>0) { 
					$('#nowplaying').show(); 
				}
			}
			function showPlaylist() { 
				$('#playlist').show(); 
			}
			function urlencode(str) { 
				return escape(str).replace('+', '%2B').replace('%20', '+').replace('*', '%2A').replace('/', '%2F').replace('@', '%40');
			}
			function playlistStripe() {
				$('#pl .newtrack:odd').addClass("odd");
				$('#pl .newtrack:even').addClass("even");
			}
			function subsearch(term,area,count,offset) { 
				$.ajax({
					data:{ view:'search', 
						keyword:term, 
						scope:area, 
						offset:offset 
					},
					url:"view.php",
					success: function (a) {
						$('#results').html(a);
						$('#results .album_track:odd').addClass("odd");
						$('#results .album_track:even').addClass("even");
						$('#results .spage').button();
					}
				});
			}
			function viewsConnect(view,id,title) {
				$.ajax({ 
					data:{ 
						view:view, 
						id:id, 
						title:title
					},
					url:"view.php",
					success: function(a,b,c) { 
						$('#pl').append(a);
						playlistStripe();
						$('#pl .newtrack').fadeIn('fast');
						$('#leftinner .album active').click();
						totalTime();	
					}
				});
			}
			function sortList() {
				var mylist = $('#leftinner ul');
				var listitems = mylist.children('li').get();
				listitems.sort(function(a, b) {
					var compA = $(a).text().toUpperCase();
					var compB = $(b).text().toUpperCase();
					return (compA < compB) ? -1 : (compA > compB) ? 1 : 0;
				});
				$.each(listitems, function(idx, itm) { 
					mylist.append(itm); 
				});
			}
			function startUI() {
				$('#pl').sortable({   
					handle:'.grip',
					axis:'y',
					forcePlaceholderSize:'true',
					placeholder:'ui-state-highlight',
					containment:'parent',
					items:'.newtrack',
					helper: 'clone',
					opacity: '.5'
				});			
				$("#volume").slider({
					range: "min",
					value: 0,
					min: 0,
					max: 100,
					slide: function(event, ui) {
						$("#amount").text(ui.value);
						player.sendEvent('VOLUME',$('#volume').slider("value"));
					}
				}).show();
				$('#volume .ui-slider-range').addClass('ui-corner-all ui-state-hover');
			}
			function liveCheck() {
				$.ajax({
					type:"GET",
					url:"view.php",
					dataType:'html',
					data:({ view:'live' }),
					success: function(a){ 
						$('#livetext').html(a); 
					} 
				});
				setTimeout("liveCheck()",15000);
			}
			function getRand() {
				$.ajax({
					type:"GET",
					url:"view.php",
					dataType:'html',
					data:({ 
						view:'randomalbum', 
						size:10 
					}),
					success: function(a){ 
						$('.rtext').html(a); 
					} 
				});
			}
			function fetchList(type) {
				$.ajax({
					url:'view.php',
					data:({ view:'mode', type:type  }),
					type:'GET',
					dataType:'html',
					success: function(a) {  
						$('#leftinner').html(a); 
						sortList();
						var availableTags = new Array();
						$('#leftinner .clk').each(function(){ //autocomplete search
							artist = trim($(this).attr('album').substr(0,$(this).attr('album').indexOf('-',$(this).attr('album'))));
							album = trim($(this).attr('album').substr($(this).attr('album').indexOf('-',$(this).attr('album'))+1));
							if(inArray(artist,availableTags) == -1) availableTags.push(artist);
							if(inArray(album,availableTags) == -1) availableTags.push(album);
						});
						$("#term").autocomplete({ source: availableTags });
						$("#searchbartext").autocomplete({ source: availableTags });
					},
					error: function(a) { 
						$('.rtext').append(a);  
					}
				});
			}
			function createMoviePlayer(type,buffer,w,h) {
				swfobject.removeSWF('player');
				swfobject.removeSWF('player1');				
				flashvars = {
					'screencolor':'#545454',
					'id':'player1',
					'bufferlength':buffer,
					'autostart':'true',
					'controlbar':'none'
				};
				var params = {
					'allowscriptaccess':'always',
					'allowfullscreen':'true',
					'wmode':'transparent'
				};
				if (type == "music") {
					flashvars.controlbar="none";
					flashvars.icons="false";
					//flashvars.plugins="ifequalizer-1&ifequalizer.gain=1&ifequalizer.showpeaks=true&ifequalizer.barbasecolor=02049c&ifequalizer.bartopcolor=f58400&ifequalizer.barspacing=1&ifequalizer.nodethickness=1&ifequalizer.nodespacing=1&ifequalizer.showpeaks=false&ifequalizer.channels=both&ifequalizer.reverseleft=true";
					flashvars.plugins="ifequalizer-1&ifequalizer.gain=1&ifequalizer.showpeaks=true&ifequalizer.barbasecolor=02049c&ifequalizer.bartopcolor=000&ifequalizer.barspacing=1&ifequalizer.nodethickness=1&ifequalizer.nodespacing=1&ifequalizer.showpeaks=false&ifequalizer.channels=both&ifequalizer.reverseleft=true";
					$('#lhead').text('Music');
					$('#playercont').position({ 
						my:'top left', 
						at:'top left', 
						of:'#nowplaying', 
						offset:'-120 -50' 
					});   
					var attributes = { 
						'id':'player1', 
						'name':'player1' 
					};
					swfobject.embedSWF('mediaplayer/'+type+'.swf', 'player', w, h, '9', 'swfobject/expressInstall.swf', flashvars, params, attributes);
					$('#bottombox').position({ 
						my:'left top', 
						at:'left bottom', 
						of:'#nowplayingvideo', 
						offset:'5 40'
					});
				}
				else { 
					$('#lhead').text('Videos');			
					var attributes = { 
						'id':'player1', 
						'name':'player1' 
					};
					swfobject.embedSWF('mediaplayer/'+type+'.swf', 'vidplayer', w, h, '9', 'swfobject/expressInstall.swf', flashvars, params, attributes);	
				}
			}
			$(document).ready(function(){
				$('.delplay').live('click',function() {
					$.ajax({
						url:'view.php',
						type:'POST',
						data:({ 
							view:'delplaylist', 
							playlistid:id 
						}),
						success:function(b){ 
							$('.rtext').append(b);
						}
					});
				});
				createMoviePlayer('music','-1','375','90');
				startUI();
				postLive('idle');
				$('#xdi').live('click',function(){
					$('#distreams').html("<img style='margin-top:75px; margin-left:100px' src='img/loading2.gif' />");
					diInfo();
					$('#distreams').dialog({
						autoOpen:true, 
						height: 400, 
						width: 350,
						modal: true, 
						resizable: false, 
						closeOnEscape: true,
						zIndex:400 
					});
				});
				$('input:#rvideo').live('click',function(){  //video radio button
					$('#vidplayercont').html("<div id='vidplayer'></div>");
					$('#bottombox').remove();
					$('#playercont').html('').hide();
					$('#vidplayercont').show();
					$('#albuminfo').hide();
					$('#nowplaying').hide();
					$('#playlist').hide();
					$('#streams').hide();
					$('#chat').hide();
					$('#livelook').hide();
					createMoviePlayer('movie','15','640','440');
					$('#playercont').html("<div id='player'></div>");
					$('#nowplayingvideo').show();
					fetchList('video');
				});
				$('input:#rmusic').live('click',function(){ //music radio button
					$('#playercont').show()
					$('#vidplayercont').html('').hide();
					$('#nowplayingvideo').hide();
					$('#buttonbox').show();
					$('#albuminfo').show();
					$('#nowplaying').show();
					$('#streams').show();
					$('#chat').show();
					$('#livelook').show();
					createMoviePlayer('music','-1','375','90');
					$('#buttonbox').position({ 
						my:'left top', 
						at:'left bottom', 
						of:'#nowplaying', 
						offset:'0 5'
					});
					fetchList('music'); 
				});
				$('#AJ').live('click',function() {
					list = new Array();
					list[0] = { 
						file:'http://freespeech.ic.llnwd.net/stream/freespeech_thealexjonesshow32k',
						title:'Alex Jones',	
						provider:'sound'
					};
					postLive('Alex Jones Radio','Live','http://freespeech.ic.llnwd.net/stream/freespeech_thealexjonesshow32k');					
					streamInfo("http://freespeech.ic.llnwd.net/stream/freespeech_thealexjonesshow32k");
					streamStart(list[0]);
					$('#nowplaying').html("<img src='img/aj.png' /><div id='nowplayingtext'><div id='np_band'>Alex Jones - </div><div id='track_name'>Radio Show</div><div id='bottombox'></div></div>");
				});
				$('#buttons').buttonset();
				$('#buttons button').each(function(i){ 
					$(this).css('width','55px'); 
				});
				$('#buttons .streamimgset').eq(0).css('backgroundImage','url(/img/world.png)');
				$('#buttons .streamimgset').eq(1).css('backgroundImage','url(/img/world.png)');
				$('#searchbutton').button().css('height','24px').css('top','1px');
				<?php
					if (ADMIN == 1) {
						echo "$('#deleteuser').live('click',function() { \n
							a = $(this).prev().val();\n
							$.ajax({\n
								url:'/admin.php',\n
								data:({ deleteuser:a  }),\n
								type:'GET',\n
								dataType:'text',\n
								success: function(a) { \n
									$('.dresponse').text(a); \n
								},\n
								error: function(a) { \n
									$('.dresponse').text(a);  \n
								}\n
							}); \n
						});\n
						\n";
						echo "$('#adduser').live('click',function() {\n
							username = $('#unadd').val();\n
							pw = $('#pwadd').val()\n
							$.ajax({\n
								url:'/admin.php',\n
								data:({ username:username, password:pw  }),\n
								type:'POST',\n
								dataType:'text',\n
								success: function(a) {\n
									$('.dresponse').text(a); \n
								}\n
							});\n
							return false; \n
						});\n
						\n";
						echo "$('#clearcurrent').live('click',function(){ \n
							droplive('all');  \n
						});\n";
					}
				?>
				$('#logout').live("click",function(){ 
					window.location = '/logout.php'; 
				});
				var firstrun = true
				$('#menu').buttonset();
				$('#menu .headerimgset').eq(0).css("backgroundImage","url('/img/0.png')");
				$('#menu .headerimgset').eq(1).css("backgroundImage","url('/img/1.png')");
				$('#menu .headerimgset').eq(2).css("backgroundImage","url('/img/2.png')");
				$('#menu .headerimgset').eq(3).css("backgroundImage","url('/img/3.png')");
				$('#menu .headerimgset').eq(4).css("backgroundImage","url('/img/4.png')");
				$('#menu .headerimgset').eq(5).css("backgroundImage","url('/img/5.png')");
				$('#menu').show();
				$('#cback').button({ 
					text:false,
					icons: { 
						primary: 'ui-icon-seek-start' 
					} 
				});
				$('#cplaypause').button({ 
					text:false, 
					icons: { 
						primary: 'ui-icon-play' 
					} 
				}).live('click',function(){ 
					player.sendEvent('PLAY');  
				});
				$('#cstop').button({ 
					text:false, 
					icons: { 
						primary: 'ui-icon-stop'
					} 
				}).click(function() { 
					player.sendEvent('STOP');	
				});
				$('#cnext').button({ 
					text:false, 
					icons: { 
						primary: 'ui-icon-seek-end'
					}	
				}).click(function() { 
					shuffleCheck(); 
				});
				$('#mute').button({ 
					text:false, 
					icons: { 
					primary: 'ui-icon-volume-on' 
					} 
				}).click(function() { 
					player.sendEvent('MUTE'); 
				});
				$("#amount").text($("#volume").slider("value"));
				$('#menu .menutext').eq(3).css('marginLeft','-2px');
				$('#menu .menutext').eq(4).css('marginLeft','-3px');
				$('#menu .menutext').eq(2).css('marginLeft','-3px');
				$('#controls').show();
				$('#clearpl').button({ 
					text:false, 
					icons:{ 
						primary:'ui-icon-trash'
					}
				});
				$('#loadplaylist .removepl').live('click',function(){ 
					var id=$(this).attr('pid');
					$.ajax({ 
						url:'view.php',
						type:'POST',
						data:({ 
							playlistid:id, 
							view:'delplaylist' 
						}),
						success:function(a){ 
							$('#plstatus').text(a); 
							$(this).parent().remove();
						}
					});
				});
				$('#savepl').button({ 
					text:false, 
					icons:{ 
						primary:'ui-icon-disk'
					} 
				}).click(function() {
					$('#saveplaylist').dialog({ 
						autoOpen:true, 
						height:200, 
						width:250,
						modal:true, 
						resizable:false, 
						closeOnEscape:true, 
						zIndex:10  
					}); 
					$(this).removeClass('ui-state-focus');
				});	
				$('#createpl').live('click',function(){
					a=$('#plname:input').val();
					b='songId='+$('#pl .newtrack').eq(0).attr('songid');
					x=1;
					while (x<$('.newtrack').size()) {
						b=b+'&songId='+$('#pl .newtrack').eq(x).attr('songid');
						x++;
					}
					$.ajax({
						url:'view.php',
						type:'POST',
						data:({ 
							name:a, 
							view:'addtoplaylist', 	
							songid:b 
						}),	
						success:function(a) { 
							$('#saveplaylist .status').text('Playlist saved with '+x+' songs total.');
						}
					});
				});
				$('#loadpl').button({ 
					text:false, 
					icons:{
						primary:'ui-icon-folder-open'
					}	
				}).click(function() {
					$('#plstatus').text();
					$(this).removeClass('ui-state-focus');
					$("button", ".close").button();
					$("#loadplaylist").dialog({ 
						autoOpen:true, 
						height: 250, 
						width: 240,	
						modal: true, 
						resizable: false, 
						closeOnEscape: true,	
						zIndex:400, 
						dialogClass:"load" 
					});
					ajaxFunction('bla',"playlists");
				});	
				$('#playlistfunc').show();
				$('#done').button();
				$('#saveconfig').button();
				$('#done').click(function(){ 
					$('#search').dialog('destroy'); 
				});
				$('#plbut').click(function(){ 
					$('#playlist').show(); 
					$('#albuminfo').hide(); 
				});
				$('#config').click(function(){
					$('#configopts').buttonset();
					$('#timestamp').button();	
					if($('#search').is(':visible')) { 
						$('#search').dialog('destroy'); 
					}
					$('#configd').dialog({ 
						autoOpen:true, 
						closeOnEscape:true, 
						height:'auto', 
						width:'170px', 
						show:'drop', 
						hide:'drop', 
						position:[252,61], 
						resizable:false 
					});
				});
				$("#saveconfig").click(function(){ 
					var $shuf;
					var $reap;
					var $time;
					if ($('#shuffle:checkbox').attr('checked')) $shuf = "true";
					else $shuf = "false";
					if ($('#repeat:checkbox').attr('checked')) $reap = "true";
					else $reap = "false";
					if ($('#timestamp:checkbox').attr('checked')) $time = "true";
					else $time = "false";
					$.ajax({
						url: "view.php",
						global: false,
						type: "POST",
						data: ({ view:'settings',
							user:'<?php echo $_SESSION['username']; ?>',
							shuffle:$shuf, 
							repeat1:$reap, 
							timestamp:$time 
						})
					});
					$('#configd').dialog('destroy'); 
				});
				$('#chatsub').submit(function() {
					var bla = $('#cmessage').val()
					var reg = /<([A-Z][A-Z0-9]*)\b[^>]*>/i;
					var bla1 = bla.search(reg);
					if (bla1 != -1) { 
						$('#cmessage').val(""); 
						return false; 
					}
					else {
						var bla3 = '<?php echo $_SESSION['username']; ?>';
						var tmp = urlencode(bla3+' '+bla);
						ajaxFunction('asdf','chatsend',tmp);
						oneShot();
						$('#cmessage').val("");
						return false;
					}
					return false;
				}); 
				setTimeout("doit()",2000);
				$('.prem').live("click",function(){	
					$(this).parent().remove();	
					return false; 
				});
				$('.dl').live("click",function(	){
					var a = $(this).parent().attr('songid');	
					var b="<?php echo JUKE.'rest/download.view?'.CREDS.'&id=a'; ?>";
					window.location = b;
					return false;
				});
				$('.padd').live("click",function(event){  //add a track to the playlist, invoked by play now or by clicking +
					$('#albuminfo').hide()
					event.preventDefault();
					$('#playlist').show();
					if ($(this).hasClass('search')) {
						var bg="<?php echo JUKE."rest/getCoverArt.view?".CREDS."&size=115&id="; ?>"+$(this).attr('cover');
					}
					else var bg=$('#cover').find('img').attr('src');
					if ($('#rvideo:input').is(':checked')) {
						$('#playlist').position({ my:'top left', at:'bottom left', of:'#playercont', offset:'300 675' });
						$('#pl').append("<div class='newtrack video' songid=" +$(this).attr('songid')+ " time=" +$(this).attr('time')+ " duration=" + $(this).attr('duration') + " ><img src="+bg+ " /><div class='grip ui-icon ui-icon-grip-dotted-vertical'></div><div class='tholder'><div class='band'>"+$(this).attr('artist')+"</div><div class='tracktext'>"+$(this).attr('track')+"</div></div><div class='duration'>"+$(this).attr('time')+"</div></div>");
					} else { 
						$('#pl').append("<div class='newtrack' songid=" +$(this).attr('songid')+ " time=" +$(this).attr('time')+ " duration=" + $(this).attr('duration') + " ><img src="+bg+ " /><div class='grip ui-icon ui-icon-grip-dotted-vertical'></div><div class='tholder'><div class='band'>"+$(this).attr('artist')+"</div><div class='tracktext'>"+$(this).attr('track')+"</div></div><div class='duration'>"+$(this).attr('time')+"</div></div>");
					}
					totalTime();
					$('#pl .newtrack:last').fadeIn(1000);
					playlistStripe();
				});
				$('#pl .newtrack').live("click",function(){ //clicking a track in the playlist, invoked by play now
					if($(this).is('.stream')) { //stream?
						var list = new Array(); 
						list[0] = {
							title:$(this).attr('title'),
							file:$(this).attr('url'),
							provider:"sound"
						};
						list.length = 1;
						$('*').removeClass("nowplaying");
						$('#nowplaying').html("<img src="+$(this).find('img').attr('src')+" /><div id='nowplayingtext'><div id='np_band'>Digitally Imported - </div></b><div id='track_name'>"+$(this).attr('title')+"</div><div id='bottombox'></div></div></div>");			
						streamInfo($(this).attr('url'));
						$(this).addClass('nowplaying');
						streamStart(list[0]);
						postLive('Digitally Imported',$(this).attr('title'),'a','~','img/di.gif',$(this).attr('url'));
					}
					else { 
						var list = new Array();
						list[0] = {
							file:'<?php echo JUKE.'rest/stream.view?'.CREDS; ?>&id='+$(this).attr('songid'),
							duration:$(this).attr('duration'),
							provider:"sound"
						};
						id = $(this).attr('songid');
						list.length = 1;
						var song = $(this).find('.band').text()+' - '+$(this).find('.tracktext').text();				
						if($(this).hasClass('video')) {  //is it video?
							list[0].provider = "video";
							$('#nowplayingvideo').html("<div id='bottombox'><div id='slider'></div><div class='np_pos'></div><div class='np_dur'>"+$(this).attr('time')+"</div></div>");			
							$('#playlist').hide();					
							$('#bottombox').position({ my:'left top', at:'left top', of:'#nowplayingvideo', offset:'5 40'});
						} else { 
							$('#nowplaying').html("<img src="+$(this).find('img').attr('src')+" /><div id='nowplayingtext' songid="+id+"><div id='np_band'>"+$(this).find('.band').text()+" - </div></b><div id='track_name'>"+$(this).find('.tracktext').text()+"</div><div id='bottombox'><div id='slider'></div><div class='np_pos'></div><div class='np_dur'>"+$(this).attr('time')+"</div></div></div>");
						}
						$('*').removeClass("nowplaying");
						$("#slider").slider({
							animate:'true', 
							min:'0', 
							max:parseInt($(this).attr('duration')), 
							slide:function(event,ui) { 
								player.sendEvent('PAUSE'); 
								player.sendEvent('SEEK',ui.value);
							}, 
							value: 0
						});
						$(this).addClass('nowplaying');
						streamStart(list[0]);
						postLive($(this).find('.band').text(),$(this).find('.tracktext').text(),id,$(this).attr('duration'),$(this).find('img').attr('src'));
					}
				});
				$('#livetext .playnow').live('click',function(){ 
					$(this).prev().click(); 
					$('.newtrack:last').click(); 
				});
				$('#livetext .ladd').live('click',function(){
					if ($(this).hasClass('stream')) {
						$('#pl').append("<div class='newtrack stream' url=" +$(this).attr('songid')+ " time='~' duration='~' ><img src="+$(this).attr('cover')+ " /><div class='grip ui-icon ui-icon-grip-dotted-vertical'></div><div class='tholder'><div class='band'>"+$(this).attr('artist')+"</div><div class='tracktext'>"+$(this).attr('track')+"</div></div><div class='duration'>"+$(this).attr('time')+"</div></div>");
					}
					else { $('#pl').append("<div class='newtrack' songid=" +$(this).attr('songid')+ " time=" +$(this).attr('time')+ " duration=" + $(this).attr('duration') + " ><img src="+$(this).attr('cover')+ " /><div class='grip ui-icon ui-icon-grip-dotted-vertical'></div><div class='tholder'><div class='band'>"+$(this).attr('artist')+"</div><div class='tracktext'>"+$(this).attr('track')+"</div></div><div class='duration'>"+$(this).attr('time')+"</div></div>"); }
					totalTime();
					$('.newtrack:last').fadeIn(1000);
					playlistStripe();
				});
				$('.streamgenre').live("click",function(){	//di.fm stream clicked
					$('#clearpl').click();
					$.ajax({
						url:"view.php",
						dataType:'html',
						data:({ 
							view:'loadstream', 
							pic:'img/di.gif', 
							genre:$(this).find('a').attr('title'),
							url:$(this).find('a').attr('pls') 
					}),
						success: function(a){ 
							$('#pl').append(a);
							$('#pl .newtrack stream:odd').addClass("odd");
							$('#pl .newtrack stream:even').addClass("even"); 
							$('#pl .newtrack:first').click(); 
						}
					});
					$('#distreams').dialog('destroy');
					$('#albuminfo').hide()
					$('#playlist').show();
				});
				$('#results .playnow').live("click",function(i){  //search result - play now clicked
					$(this).prev().prev().click();
					$('#albuminfo').hide();
					$('#playlist').show();
					setTimeout("$('#pl .newtrack:last').click()",200);
				});
				$('#leftinner .playnow').live("click",function(i){	//main album list - play now clicked
					$(this).prev().prev().click();
					$('#albuminfo').hide();
					$('#playlist').show();
					var bg=$('#cover').find('img').attr('src');
					setTimeout("$('#pl .newtrack:last').click()",200);
				});
				$('#leftinner .ttext').live('dblclick',function(e){
					$(this).prev().prev().click();
				});
				$('.newtrack').live("contextmenu", function(e) { //right click menu for playlist - download/remove
					$('#pl .newtrack').removeClass('tmp');
					$(this).addClass('tmp');
					$('#rtclk').css({ top: e.pageY+'px',left: e.pageX+'px' }).show();
					$('#rtdl').attr('href',"<?php echo JUKE."rest/download.view?".CREDS."&id=+$(this).attr('songid')"; ?>");
					$('#rtrm').live('click',function() { 
						$('#pl .tmp').remove(); 
					});
					return false;
				});
				$('#rtmv').live('click',function() {
					$('#pl').sortable("destroy");
					a = "<div style='display: block;'  class='newtrack'>"+$('#pl .tmp').html()+"</div>";
					b = parseInt(prompt('Move to track number:')) - 1;
					$('#pl .newtrack').eq(b).before(a);
					$('#pl .tmp').remove();
					playlistStripe();
				});		
				$('#rtdl').click(function() { 
					$('#rtclk').hide(); 
					$('#pl .newtrack').removeClass('tmp');
				});
				$(document).click(function() { 
					$('#pl .newtrack').removeClass('tmp');
					$('#rtclk').hide(); 
				});
				$('#leftinner .album').live("click",function(e){  //loading album tracks/closing current album
					if (!$(this).hasClass('inneralbum')) {
					if($('#leftinner .album.active').length == 0) { 
						$("#leftinner").scrollTo($(this),400,{easing:'swing'});
					}
					if ($(this).hasClass('active')) { 
						$(this).next().html(''); 
						$(this).removeClass('active').removeClass('ui-state-active').next().removeClass('active'); 
						return false; 
					}
					$('#leftinner .actrack.active').hide(300,function() {
						active = $('#leftinner .album.active');
						$("#leftinner").scrollTo(active,400,{easing:'swing'});
					});
					$(this).addClass('ui-state-active');
					$('#leftinner .actrack.active').html('');
					$('#leftinner .album.active').removeClass('active').toggleClass('ui-state-active');
					$('#leftinner .actrack.active').removeClass('active');
					$(this).addClass('active').next().addClass('active');
					$('#cover').remove();
					}
					$('.preload').show();
					if($(this).parent().parent().parent().parent().attr('id') == "left") { //root folder?
						ajaxFunction($(this).find('a').eq(1).attr("albumid"),"album","bla");
					} 
					var level = $(this).attr('level');
					var status = parseInt(level)+1;
					$('#leftinner .inneralbum[level='+level+']').next().html('');
					$('#leftinner .active.inneralbum').removeClass('active').next().removeClass('active');
					if($(this).hasClass('inneralbum')) { 
						$(this).addClass('active');
						ajaxFunction($(this).find('a').eq(1).attr("albumid"),"album",$(this).find('a').eq(1).attr("inner"),level);
					}
					else if($(this).hasClass('inner')) { 
						$(this).addClass('active');
						ajaxFunction($(this).attr("albumid"),"album",$(this).attr("inner"),level);
					}
					return false;
				});
				$('#leftinner .album').live('hover',function() { 
					if (!$(this).hasClass('inneralbum')) {
						$(this).toggleClass('ui-state-hover'); 
					}
				});
				$('#leftinner .addinner').live('click',function(e){
					album = $(this).next().text();
					id = $(this).attr("albumid");
					viewsConnect('addfolder',id,album);
					$('#albuminfo').hide();
					$('#playlist').show();
					return false;
				});
				$('#leftinner .addfolder').live("click",function(event){ //adding entire album(s)
					$('#albuminfo').hide();
					$('#playlist').show();
					active = $(this).closest('.album');
					id = active.find('.clk').attr('albumid');
					bla = active.find('.clk').attr('album');
					viewsConnect('addfolder',id,bla);
					return false;
				});
				$("button", ".close").click(function() { 
					$('#loadplaylist').dialog('destroy'); 
				});
				$("#clearpl").click(function() { 
					$('#pl').html("") 
				});
				$('#sbutton').click(function() {
					if($('#configd').is(':visible')) {
						$('#configd').dialog('destroy');	
					}
					$('#search').dialog({ 
						autoOpen:true, 
						closeOnEscape:true, 
						height:'auto', 
						width:'470px', 
						show:'drop', 
						hide:'drop', 
						position:[322,67], 
						resizable:false 
					});
				});	
				$('#searchnow').button();
				$('#searchbutton').click(function() {
					if($('#configd').is(':visible')) {
						$('#configd').dialog('destroy');	
					}
					a = $('#newsearch input:checked').attr('value');
					$('#search').dialog({ 
						autoOpen:true, 
						closeOnEscape:true, 
						height:'auto', 
						width:'470px', 
						show:'drop', 
						hide:'drop', 
						position:[322,67], 
						resizable:false 
					});
					var keyword = $('#searchbartext').val();
					subsearch(keyword,a);
					$('#term').val(keyword);
					$('#research input[value='+a+']').attr('checked','checked');
				});
				$('#research').submit(function(){ 
					$('#searchnow').click(); 
					return false; 
				});
				$('#newsearch').submit(function(){ 
					$('#searchbutton').click(); 
					return false; 
				});
				$('#searchnow').live('click',function() {
					var keyword = $('#term').val();
					a = $('#research input:checked').attr('value');
					subsearch(keyword,a);
				});
				$('#search .spage').live('click',function(){
					var keyword = $('#term').val();
					a = $('#research input:checked').attr('value');
					subsearch(keyword,a,'null',$(this).attr('offset'));
				});
				$('.loadplaylist').live("click",function(){	
					$('#loadplaylist').dialog('close'); 
					$('#playlist').show(); 
					$('#albuminfo').hide(); 
					ajaxFunction($(this).attr('pid'),"loadplaylist","bla"); 
					$('#pl').html("<img style='margin-left:130px; margin-top:95px;' src='img/loading1.gif' ><br><span style='margin-left:190px;'>loading</span>"); 
					$('loadplaylist').dialog('destroy'); 
				});
				$.ajax({  //loading user preferences from server 
					url: "view.php",
					type: "GET",
					data: ({ 
						view:'prefs', 
						username:"<?php echo $_SESSION['username']; ?>"
					}),
					dataType: "text",
					success: function(msg){
						var bla = new Array();
						bla = msg.split(',');
						if (bla[0] == 1) {
							$('#cshuffle:input').attr('checked',true);
							$('#shuffle:input').attr('checked',true);
						}
						if (bla[1] == 1) {
							$("#crepeat:checkbox").attr('checked',true);
							$("#repeat:checkbox").attr('checked',true);
						}
						if (bla[2] == 1) {
							$("#ctimestamp:checkbox").attr('checked',true);
							$("#timestamp:checkbox").attr('checked',true);
						}
						$('#cplaylist').buttonset();
						$('#crepeat').button({ 
							icons: { 
								primary: 'ui-icon-refresh'
							} 
						});
						$('#cshuffle').button({
							icons: { 
								primary: 'ui-icon-shuffle' 
							} 
						});
					}
				});
				$('button').live('click',function(){ 
					$(this).removeClass('ui-state-focus');
				});
				liveCheck();
				var mylist = $('#leftinner ul');
				var listitems = mylist.children('li').get();
				listitems.sort(function(a, b) {
					var compA = $(a).text().toUpperCase();
					var compB = $(b).text().toUpperCase();
					return (compA < compB) ? -1 : (compA > compB) ? 1 : 0;
				});
				$.each(listitems, function(idx, itm) { 
					mylist.append(itm); 
				});
				fetchList('music'); 
				<?php 
					if (ADMIN == 1) {
						echo "\n$('#tabs').tabs();\n";
						echo "$('#admin').live('click',function(){ 
							$('#admind').dialog({ dialogClass:'admind',modal:'true',autoOpen:'true',closeOnEscape:'true',show:'drop',hide:'drop',height:400,width:550,position:'center'    });	\n
							$('#admind .ui-tabs-nav').removeClass('ui-widget-header');\n
							$('#admind *').removeClass('ui-widget-content');\n
							});\n ";
					}
				?>
			});
		</script>
		<script language="javascript" type="text/javascript">
			<!-- 
			function ajaxFunction(a,b,c,d){
				var ajaxRequest;  // The variable that makes Ajax possible!		
					try{ // Opera 8.0+, Firefox, Safari
						ajaxRequest = new XMLHttpRequest();
					} catch (e){ // Internet Explorer Browsers
						try{
							ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
						} catch (e) {
							try{
								ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
							} catch (e){ // Something went wrong
								return false;
							}	
						}
					}	
					// Create a function that will receive data sent from the server
					ajaxRequest.onreadystatechange = function(){
						if(ajaxRequest.readyState == 4){	
							if(b=="album") {
								if(c!="bla") {
									$("#leftinner .active.album[level="+d+"]").next().html(ajaxRequest.responseText);
								}
								else {
									$('#leftinner .actrack.active').html(ajaxRequest.responseText);
									$('#leftinner .album_track:odd').addClass("odd");
									$('#leftinner .album_track:even').addClass("even");
									$('#leftinner .actrack.active').animate({ opacity:'show' },1000,'linear');
								}
								$('.preload').hide();
							}
							if(b=="chat") { $('.text').html(ajaxRequest.responseText+'</br>'); }
							if(b=="chatsend") {
								if ($("#timestamp:checkbox").attr('checked') == true) ajaxRequest.open("GET","view.php?view=chat&timestamp=true", true);
								else ajaxRequest.open("GET","view.php?view=chat", true);
							}
							if(b=="playlists") { 
								$('.playlists').html(ajaxRequest.responseText);
							}
							if(b=="loadplaylist") {
								$('#pl').html(ajaxRequest.responseText);
								playlistStripe();
								totalTime();				
							}
						}
					}
				if(b=="album") {
					if (c=='bla') {
						ajaxRequest.open("GET", "view.php?view=album&level=0&id=" + a, true);
					}
					else {
						ajaxRequest.open("GET", "view.php?view=album&level="+d+"&id=" + a, true);
					}
				}
				if(b=="chat") {
				if ($("#timestamp:checkbox").attr('checked') == true) { 
					ajaxRequest.open("GET","view.php?view=chat&timestamp=true", true); 
				}
				else ajaxRequest.open("GET","view.php?view=chat", true);
			}
			if(b=="chatsend") ajaxRequest.open("GET","view.php?view=chatsend&message="+c, true);
			if(b=="playlists") ajaxRequest.open("GET","view.php?view=playlists",true); 
			if(b=="loadplaylist") ajaxRequest.open("GET","view.php?view=loadplaylist&id="+a,true);
			ajaxRequest.send(null); 	
		}
		//-->
		</script>
		</head>
		<body onUnload='droplive()'>
			<div id="container">
				<div id='lmb'>
					<div id='menu'><button class='menubtn' id='home' onclick="home()"><div class='headerimgset'></div><div class="menutext">Home</div></button><button id='sbutton'><div class='headerimgset'></div><div class="menutext">Search</div></button><button id='plbut'><div class='headerimgset'></div><div class='menutext'>Playlist</div></button><button id='config'><div class='headerimgset'></div><div class="menutext">Config</div></button><button id='logout'><div class='headerimgset'></div><div class="menutext">Logout</div></button><?php if(ADMIN == '1') { echo "<button id='admin'><div class='headerimgset'></div><div class='menutext'>Admin</div></button>"; } else echo "<button id='refresh'><div class='headerimgset'></div><div class='menutext'>Refresh</div></button>"; ?></div>
					<div id="left" class="ui-corner-all ui-widget ui-widget-content">
						<div id="lhead" class="ui-corner-top ui-widget-header">Full Albums</div>
						<div id="leftinner" class="ui-widget-content"></div>
						<div id='leftfoot'>
							<form style='height:16px;' id='modes'>
								<input id='rmusic' type="radio" name="mode" checked="checked" value="music" /> Music
								<input id='rvideo' type="radio" name="mode" value="video" /> Video
							</form> 
							<div class='preload ui-helper-hidden'>
								<img src='img/25.gif' />
							</div>
						</div>
					</div>
				</div>
				<div id='rc' class='ui-helper-clearfix'>
					<div id="vidplayercont"><div id="vidplayer"></div></div>
					<div id='streams'>
						<div id='buttons'>
							<button id='AJ' class='streambutton'>
								<div class='streamimgset'></div>
								<div class="menutext">AJ</div>
							</button>
							<button id='xdi' class='streambutton'>
								<div class='streamimgset'></div>
								<div class="menutext">DI.fm</div>
							</button>
						</div>
						<form id='newsearch'>
							<div id='searchbar' class='ui-widget-content'>
								<input id='searchbartext' type='text' />
								<button id='searchbutton'>Search</button><br />
								<input class='searchall' type='radio' checked='checked' name='stype'  value='any' />All
								<input class='searchartist' type='radio' name='stype' value='artist' />Artist
								<input class='searchalbum' type='radio' name='stype' value='album' />Album
								<input class='searchsong' type='radio' name='stype' value='song' />Song
							</div>
						</form>
					</div>
				<div id="nowplaying"></div>
				<div id="nowplayingvideo"></div>
				<div id="chat" class="ui-corner-all ui-widget-content">
					<div id="chead" class="ui-widget-header ui-corner-top">Chat - <?php echo $_SESSION['username']; ?></div>
					<div class="text"></div>
					<form id='chatsub'>
						<input name='name' type='hidden' value='<?php echo $_SESSION['username']; ?>' />
						<div id="chat-buttons">
							<div id="chat-message" class="ui-widget">
								<input id="cmessage" type='text' name="message" />
							</div>
						</div>
					</form>
				</div>
				<div id='buttonbox'>
					<div id='controls'>
						<button id='cback'>Back</button>
						<button id='cplaypause'>Play/Pause</button>
						<button id='cstop'>Stop</button>
						<button id='cnext'>Next</button>
					</div>
					<div id='cplaylist'>
						<form style="display:inline;">
							<input id='cshuffle' type='checkbox' name='cshuffle' /><label for='cshuffle'>Shuffle</label>
							<input id='crepeat' type='checkbox' name='crepeat' /><label for='crepeat'>Repeat</label>
						</form>
					</div>
					<button id='mute'>Mute</button>
					<div id='volume'></div>
					<div id='amount'></div>
					<div id='playlistfunc'>
						<button id='savepl'>Save Playlist</button>
						<button id='clearpl'>Clear Playlist</button>
						<button id='loadpl' class='loadit'>Load Playlist</button>
					</div>
				</div>
				<div id="playlist" class="ui-corner-all ui-widget-content">
					<div id="phead" class="ui-corner-top ui-widget-header">Playlist</div>
					<div id="pl"></div>
					<div id='plfoot'></div>
				</div>
				<div id="albuminfo" class='ui-widget-content ui-corner-all'>
					<div id="album_name" class="ui-corner-top ui-widget-header">Welcome to the stash</div>
					<div id="tracks">
						<div class='rtext'>
							<br /><br />
						</div>	
					</div>
				</div>
				<div id='livelook' class='ui-corner-all ui-widget-content'>
					<div id='livehead' class='ui-widget-header ui-corner-top'>Who's Online</div>
					<div id='livetext'></div>
				</div>
			</div>
		</div>
		<div id="search" title="Search..">
			<form id='research'>
				<input style='margin-left:5px; margin-right:3px;' id='term' type='text' />
				<button id='searchnow'>Search</button>
				<input class='searchall' type='radio' checked='checked' name='stype'  value='any' />All
				<input class='searchartist' type='radio' name='stype' value='artist' />Artist
				<input class='searchalbum' type='radio' name='stype' value='album' />Album
				<input class='searchsong' type='radio' name='stype' value='song' />Song
			</form>
			<div id='results'></div>
			<button style='float:right; margin-top:4px;' id='done'>Done</button>
		</div>
		<div id='rtclk'>
			<a href='#' id='rtmv'><img src='img/move.gif'>Move</a><br />
			<a href='#' id='rtdl'><img src='img/dl.gif'>Download</a><br />
			<a href='#' id='rtrm'><img src='img/remove.gif'>Remove</a>
		</div>
		<div id='distreams' title='Choose a DI.fm Stream to Load'></div>
		<div id='saveplaylist' title='Enter name for playlist'><br />
			<input id='plname' name='plname' type='text' />
			<button id='createpl'>Save</button>
			<div class='status'></div>
		</div>
		<div id="loadplaylist" class="ui-widget-content" title='Pleast select a Playlist'>
			<div class="playlists"></div>
			<div style='float:left;' id='plstatus'></div>
			<div class="close" style='float:right;'>
				<button style='margin-top:3px;'>Close</button>
			</div>
		</div>
		<div id='configd' title='Preferences' class='ui-widget'>
			<div id='configinner'>
				<div style="border-bottom:1px solid #545454;">
					<h3>Playlists</h3>
					<div id='configopts' style="padding-bottom:10px">
						<input id='shuffle' type='checkbox' name='shuffle' /><label for='shuffle'>Shuffle</label>
						<input id='repeat' type='checkbox' name='repeat' /><label for='repeat'>Repeat</label>
					</div>
				</div>		
				<div style="padding-bottom:10px; border-bottom:1px solid #545454; ">
					<h3>Chat</h3>
					<input id='timestamp' type='checkbox' name='timestamp' />
					<label for='timestamp'>Timestamp</label><br />
				</div>
				<div style="padding-bottom:10px; border-bottom:1px solid #545454; ">
					<h3>Stylesheet</h3>
					<SELECT NAME="stylesheet">
						<OPTION>thin.css</OPTION>
						<OPTION>nopad.css</OPTION>
					</SELECT>
				</div>	
				<button id='saveconfig'>Save</button>
			</div>
		</div>
			<?php if (ADMIN == 1) {
						echo "<div id='admind' title='Admin Panel'>
							<div id='tabs'>
								<ul>
									<li><a href='new_user.php'>Manage Users</a></li>
									<li><a href='admin_stuff.php'>General Options</a></li>
								</ul>
							</div>
						</div>";
					}
			?>
		<div id="playercont">
				<div id="player"></div>
		</div>
		</div>
	</body>
</html>	